import request from '@/utils/request'
import equipment from './equipment'
import admin from '../setting/admin'
export default {
  admin() {
    return admin.select()
  },
  leader(location_id) {
    return request({
      url: '/admin/location/leader',
      method: 'get',
      params: {
        location_id
      }
    })
  },
  append(data) {
    return request({
      url: '/admin/location/append',
      method: 'post',
      data
    })
  },
  equipment(id) {
    return equipment.tree({
      location_id: id
    })
  },
  epUpdate(data) {
    return equipment.update(data)
  },
  eqInfo(id) {
    return equipment.info(id)
  },
  index(params) {
    return request({
      url: '/admin/location/index',
      method: 'get',
      params
    })
  },
  create(data) {
    return request({
      url: '/admin/location/create',
      method: 'post',
      data
    })
  },
  update(data) {
    return request({
      url: '/admin/location/update',
      method: 'post',
      data
    })
  },
  delete(id) {
    return request({
      url: '/admin/location/delete',
      method: 'get',
      params: {
        id
      }
    })
  }
}
